Platform Explorer / Nuxeo Platform 2021.7

Component org.nuxeo.ecm.directory.sql.SQLDirectoryFactory

Documentation

SQL-based implementation for NXDirectory

Requirements

Resolution Order

774
The resolution order represents the order in which this component has been resolved by the Nuxeo Runtime framework.
You can influence this order by adding "require" tags in your component declaration, to make sure it is resolved after another component.

Start Order

801
The start order represents the order in which this component has been started by the Nuxeo Runtime framework.
This number is interesting to tweak if your Java component interacts with other components, and needs to be started before or after another one.
It can be changed by implementing the method "Component#getApplicationStartedOrder()" on your Java component: components are sorted according to this reference value, in increasing order.
The default value is 1000, and the repository initialization uses number 100. Negative values can also be used.

Implementation

Class: org.nuxeo.ecm.directory.sql.SQLDirectoryFactory

Extension Points

XML Source

<?xml version='1.0' encoding='UTF-8'?>
<component name="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory">

  <implementation class="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory"/>

  <require>org.nuxeo.ecm.directory.DirectoryServiceImpl</require>

  <documentation>
    SQL-based implementation for NXDirectory
  </documentation>

  <extension-point name="directories">
    <documentation>
      This extension point can be used to register new SQL-based
      directories. The
      extension can contain any number of directories
      declarations of the form:
      <code>
        <directory name="userDirectory">
          <schema>vocabulary</schema>
          <types>
            <type>system</type>
          </types>
          <dataSource>java:/nxsqldirectory</dataSource>
          <table>t</table>
          <nativeCase>false</nativeCase>
          <idField>username</idField>
          <passwordField>password</passwordField>
          <passwordHashAlgorithm>SSHA</passwordHashAlgorithm>
          <autoincrementIdField>false</autoincrementIdField>
          <createTablePolicy>on_missing_columns</createTablePolicy>
          <dataFile>setup-mydb.csv</dataFile>
          <dataFileCharacterSeparator>,</dataFileCharacterSeparator>
          <querySizeLimit>1000</querySizeLimit>
          <references>
            <tableReference field="groups" directory="groupDirectory" table="user2group" sourceColumn="userId" targetColumn="groupId" dataFile="user2group.csv"/>
          </references>
          <permissions>
            <permission name="Read">
              <group>mygroup</group>
              <group>mygroup2</group>
              <user>Administrator</user>
            </permission>
            <permission name="Write">
              <group>mygroup3</group>
            </permission>
          </permissions>
        </directory>
      </code>
      Here is the description for each field:
      <ul>
        <li>
          schema - the name of the schema to be used for the directory
          entries.
        </li>
        <li>
          types - list of type to categorise directories.
        </li>
        <li>
          dataSource - the dataSource name, as registered in the
          application
          server.
        </li>
        <li>
          table - The name of the sql table where the directory data
          will be
          stored.
        </li>
        <li>
          idField - the id field designs the primary key in the table,
          used for
          retrieving entries by id.
        </li>
        <li>
          passwordField - the password field.
        </li>
        <li>
          passwordHashAlgorithm - the hash used to encode the password
          written
          in the database, either empty (default), SSHA or SMD5.
        </li>
        <li>
          autoincrementIdField - if this is set true, the SQLDirectory
          will
          fill the id field using a generated unique number,
          otherwise the client
          has to supply the id.
        </li>
        <li>
          dataFile - file from which to populate the table; the
          first line must
          contain the column names. This can be a csv, tsv, psv file.
          But you
          must take care of the dataFileCharacterSeparator to specify the
          character
          separator
        </li>
        <li>
          dataFileCharacterSeparator - character that separate each value
          if
          more than one character is set, the first one is gotten and other
          are
          skipped. The character is by default "," but you can set ";" or
          tabulation
        </li>
        <li>
          createTablePolicy - one of "never", "always" or
          "on_missing_columns"
          if this is set to "never", the table will
          never be created; if set to
          "always", the table will be
          created each time the application is
          started; if set to
          "on_missing_columns", the table will be created only
          if the
          schema declares some fields that are not present in the sql
          table.
        </li>
        <li>
          querySizeLimit - the maximum number of results that the
          queries on
          this directory should return; if there are more
          results than this, an
          exception will be raised.
        </li>
        <li>
          nativeCase - false if table and column names should be used exactly
          as specificed in the configuration and schemas (quoted), true if
          they
          should be converted to database-native case (usually
          uppercase); the
          default is false for backward-compatibility.
        </li>
      </ul>
      The references tag is used to define relations between
      directories. (TODO:
      describe the references types.)
    </documentation>

    <object class="org.nuxeo.ecm.directory.sql.SQLDirectoryDescriptor"/>
  </extension-point>

</component>